<?php
//The directory in which your application specific resources are located.
define('APPLICATION', 'application');
//The directory in which your var are located.
define('VARROOT', 'var');
//Tmac返回项目文件路径的信息
$tmac_path = preg_replace("/include/", '', dirname(__FILE__));
$tmac_base_path = dirname($tmac_path);

//Tmac物理根目录
define('TMAC_ROOT', $tmac_base_path . DIRECTORY_SEPARATOR);
//Tmac虚拟根目录
define('ROOT', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']));
//application目录
define('APP_ROOT', TMAC_ROOT . APPLICATION . DIRECTORY_SEPARATOR);
//var目录
define('VAR_ROOT', TMAC_ROOT . VARROOT . DIRECTORY_SEPARATOR);
//Webroot Htdocs 网站目录
define('WEB_ROOT', $tmac_path);
//加载配置文件
require(TMAC_ROOT . 'Tmac.config.php');
//Tmac URL 根目录
define('URL', ROOT . ($TmacConfig['Common']['urlrewrite'] ? '' : 'index.php'));

$TmacConfig['Common']['errorreport'] ? error_reporting(E_ALL) : error_reporting(0);

define('ROOTINC', WEB_ROOT . '/include/');
define('ROOTTEM', WEB_ROOT . '/templets/');
define('ROOTDATA', VAR_ROOT . 'Data'.DIRECTORY_SEPARATOR);
define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());

date_default_timezone_set("PRC"); //设定为中华人民共和国 时间戳
//定义php通用属性
if (PHP_VERSION < '4.1.0') {
    $_GET = &$HTTP_GET_VARS;
    $_POST = &$HTTP_POST_VARS;
    $_COOKIE = &$HTTP_COOKIE_VARS;
    $_SERVER = &$HTTP_SERVER_VARS;
    $_ENV = &$HTTP_ENV_VARS;
    $_FILES = &$HTTP_POST_FILES;
}

//global防注入
if (isset($_REQUEST['GLOBALS']) OR isset($_FILES['GLOBALS'])) {
    exit('Request tainting attempted.');
}

require_once(ROOTINC . 'function.inc.php'); //包含通用函数库

//外部引入的(包括数据库或者文件)数据中关闭字符串自动转义
//不进行魔术过滤 php5.3废除了 set_magic_quotes_runtime(0);
ini_set("magic_quotes_runtime",0);

require_once(ROOTINC . 'db.class.php'); //包含数据库操作类
require_once(ROOTINC . 'template.class.php');

?>